package com.example.xiaomi.mapper;

import com.example.xiaomi.entity.AdminInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminMapper {

        @Select("select * from admininfo WHERE admininfo.adminname like '%${adminname}%' order by adminid desc")
        List<AdminInfo> findAllAdmin(@Param("adminname") String adminname );

        @Select("SELECT adminid,password,birthday,create_date,phone,adminname FROM admininfo WHERE adminid = #{adminid}")
        AdminInfo findAdminBYID(Integer adminid);

        @Delete("DELETE FROM admininfo WHERE adminid = #{adminid }")
        Integer deleteBYID(Integer adminid);

        @Update("update admininfo set adminname = #{adminname},birthday = #{birthday},phone= #{phone} WHERE adminid = #{adminid};")
        Integer updateAdmin(AdminInfo admin);

}

